//
//  XLSearchBar.h
//  Current
//
//  Created by 于鹏 on 2017/8/14.
//  Copyright © 2017年 YIVIEW. All rights reserved.
//

#import <UIKit/UIKit.h>
@class XLSearchBar;
typedef void(^XLSearchTextBlock)(NSString *searchText);

typedef NS_ENUM(NSUInteger,XLSearchBarStyle){
    XLSearchBarStyleDefault,
    XLSearchBarStyleProminent,
    XLSearchBarStyleMinimal
};

typedef NS_ENUM(NSUInteger, XLTextBorderStyle){
    XLTextBorderStyleNone,
    XLTextBorderStyleLine,
    XLTextBorderStyleBezel,
    XLTextBorderStyleRoundedRect
};
@protocol XLSearchBarDelegate <NSObject>

- (void)xl_searchBar:(XLSearchBar *)searchBar searchText:(NSString *)searchText;
- (void)xl_cancleSearch:(XLSearchBar *)searchBar;

@end

@interface XLSearchBar : UISearchBar<UISearchBarDelegate>

@property (nonatomic, copy) XLSearchTextBlock searchBlock;
@property (nonatomic, weak) id<XLSearchBarDelegate>searchDelegate;

/** 搜索框风格*/
@property (nonatomic, assign) XLSearchBarStyle xlSearchBarStyle;
/** 输入框的风格*/
@property (nonatomic, assign) XLTextBorderStyle textBordStyle;

/** 是否在搜索状态*/
@property (nonatomic, assign, readonly) BOOL isSearch;
/** 提示文字*/
@property (nonatomic, copy) NSString *placeholderText;
/** 提示文字的颜色 */
@property (nonatomic, strong)UIColor  *placeholderColor;
/** 搜索框(输入框除外)的背景颜色 */
@property (nonatomic, strong) UIColor  * barBackgroudColor;

/** 输入框的背景颜色 */
@property (nonatomic, strong) UIColor  * textBackgroudColor;

/** 输入文字的颜色文字的颜色 */
@property (nonatomic, strong) UIColor  * textColor;

/** “搜索“文字的颜色 */
@property (nonatomic, strong) UIColor  * searchTintColor;

/** 提示文字的大小 */
@property (nonatomic, assign) CGFloat    placeholderFontSize;

/** 输入文字的大小 */
@property (nonatomic, assign) CGFloat    textFontSize;

/** 获得搜索的Text */
- (void)searchBarTextSearchTextBlock:(XLSearchTextBlock)block;

/** 开始搜索*/
- (void)xl_becomeFirst;

/** 结束搜索*/
- (void)xl_resignFirst;




@end
